﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dqs_BLL;
using Model;
using Sunny.UI;
namespace Dqs_UI
{
	public partial class frmAddClass : UIForm
	{
		public frmAddClass()
		{
			InitializeComponent();
		}
		Class_BLL Class_BLL = new Class_BLL();
		Course_BLL Course_BLL = new Course_BLL();

		private void uiButton1_Click(object sender, EventArgs e)
		{
			ClassInfo classInfo = new ClassInfo()
			{
				Id = Class_BLL.GetClasses().Count + 1,
				ClassName = txtCourseName.Text.Trim(),
				IsMultimedia = uiRadioButton1.Checked ? true : false,
				IsOccupied = uiRadioButton4.Checked ? true : false,
				MaxCount = Convert.ToInt32(txtDescription.Text.Trim()),
				Course =  new CourseInfo() { CourseName = uiTextBox1.Text.Trim(), StartTime = DateTime.Now, EndTime = DateTime.Now.AddMonths(3) }

		};

			if (Class_BLL.InsertClassInfo(classInfo))
			{
				DialogResult = DialogResult.OK;
			}
			else
			{
				MessageBox.Show("请检查输入内容是否正确！");
			}
		}

		private void uiButton2_Click(object sender, EventArgs e)
		{
			txtCourseName.Clear();
			txtDescription.Clear();
			uiRadioButton2.Checked = true;
			uiRadioButton3.Checked = true;

		}

		private void frmAddClass_Load(object sender, EventArgs e)
		{
			
		}
	}
}
